package com.feilx.changgou.goods.service.impl;

import com.changgou.bean.PageVo;
import com.changgou.bean.Query;
import com.changgou.bean.QueryCondition;
import com.changgou.pojo.SkuInfo;
import com.changgou.pojo.TbSkuEntity;
import com.feilx.changgou.goods.dao.TbSkuDao;
import com.feilx.changgou.goods.service.TbSkuService;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;



@Service("tbSkuService")
public class TbSkuServiceImpl extends ServiceImpl<TbSkuDao, TbSkuEntity> implements TbSkuService {

    @Cacheable(value = "sku:list")
    @Override
    public PageVo queryPage(QueryCondition params) {
        System.out.println("查询数据库");
        IPage<TbSkuEntity> page = this.page(
                new Query<TbSkuEntity>().getPage(params),
                new QueryWrapper<TbSkuEntity>()
        );

        return new PageVo(page);
    }

    @Override
    public List<SkuInfo> getAll(Map map) {
        List<SkuInfo> list = this.listByMap(map);
        return list;
    }

}
